package com.oa.lms.apps.actions.absence;

import java.util.List;

import com.oa.lms.apps.actions.BasicAction;
import com.oa.lms.apps.business.absence.IAbsenceCategoryService;
import com.oa.lms.apps.constants.IDEDStatus;
import com.oa.lms.apps.entity.absence.AbsenceCategoryValue;

@SuppressWarnings("serial")
public class AbsenceCategoryAction extends BasicAction {
	
	private IAbsenceCategoryService absenceCategoryService;
	private AbsenceCategoryValue categoryInfo;
	private List<AbsenceCategoryValue> categoryList;
	
	private String categoryName;
	private String categoryId;
	
	public String addAbsenceCategory(){
		
		absenceCategoryService.add(categoryName);
		return SUCCESS;
	}
	public String toAdd(){
		
		return SUCCESS;
	}
	
	public String updateAbsenceCategory(){
		
		absenceCategoryService.modify(Integer.parseInt(categoryId),categoryName );
		return SUCCESS;
	}
	public String toUpdate(){
		categoryInfo = absenceCategoryService.queryByCategoryId(Integer.parseInt(categoryId));
		
		return SUCCESS;
	}
	public String toQuery(){
		categoryList = absenceCategoryService.queryAbsenceCategory(null, IDEDStatus.ENABLE);
		return SUCCESS;
	}
	
	public String toDeleteAbsenceCategory(){
		absenceCategoryService.delete(Integer.parseInt(categoryId));
		return SUCCESS;
	}

	public IAbsenceCategoryService getAbsenceCategoryService() {
		return absenceCategoryService;
	}
	public void setAbsenceCategoryService(
			IAbsenceCategoryService absenceCategoryService) {
		this.absenceCategoryService = absenceCategoryService;
	}
	public String getCategoryName() {
		return categoryName;
	}

	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}
	public AbsenceCategoryValue getCategoryInfo() {
		return categoryInfo;
	}
	public void setCategoryInfo(AbsenceCategoryValue categoryInfo) {
		this.categoryInfo = categoryInfo;
	}
	public String getCategoryId() {
		return categoryId;
	}
	public void setCategoryId(String categoryId) {
		this.categoryId = categoryId;
	}
	public List<AbsenceCategoryValue> getCategoryList() {
		return categoryList;
	}
	public void setCategoryList(List<AbsenceCategoryValue> categoryList) {
		this.categoryList = categoryList;
	}
	
	
}
